package com.zcyh.exam.utils;

import java.util.ArrayList;
import java.util.List;

/**
 * @author timo 2021/4/1
 */
public class CodeUtil {
    /**
     * 组合编码
     *   //[A07, A07A01, A07A01A01, A07A01A01A03, A07A01A01A03A02, A07A01A01A03A02A08, A07A01A01A03A02A08A03]
     *         String test = "A07A01A01A03A02A08A03";
     * @param string
     * @return
     */
    public static List<String> getCodesGroups(String string){
        List<String> strs = new ArrayList<String>();
        int z = 0;
        for(int i=0;i<string.length()/3;i++){
            String a = string.substring(z,z+3);
            strs.add(a);
            z = z+3;
        }
        List<String> returnStrs = new ArrayList<String>();
        StringBuffer str = new StringBuffer();
        strs.forEach(x->{
            StringBuffer append = str.append(x);
            returnStrs.add(append.toString());
        });
        return returnStrs;
    }
}
